import req from "../req";
import service from '@/utils/request'
import tool from '@/utils/tool';
// 获取角色列表
export function RoleList(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/List'),
    token:tool.data.get("TOKEN")
  }
  return service({
    url: 'Role/List',
    method: 'post',
    data: { ...data, ...a }
  });
}


// 新增
export function addRole(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/Add'),
    token:tool.data.get("TOKEN")
  }
  console.log(a);
  return service({
    url: 'Role/Add',
    method: 'post',
    data: { ...data, ...a }
  });
}

// 删除角色
export function deleteRole(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/Delete'),
    token:tool.data.get("TOKEN")
  }
  return service({
    url: 'Role/Delete',
    method: 'post',
    data: { ...data, ...a }
  });
}


// 切换状态
export function switchStatus(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/Status'),
    token:tool.data.get("TOKEN")
  }
  return service({
    url: 'Role/Status',
    method: 'post',
    data: { ...data, ...a }
  });
}


// 获取权限树
export function getAuthList(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/AuthList'),
    token:tool.data.get("TOKEN")
  }
  return service({
    url: 'Role/AuthList',
    method: 'post',
    data: { ...data, ...a }
  });
}

// 获取权限树
export function editAuth(data) {
  var a = {
    client_id: 1,
    api_token: req('Role/Edit'),
    token:tool.data.get("TOKEN")
  }
  return service({
    url: 'Role/Edit',
    method: 'post',
    data: { ...data, ...a }
  });
}